import jdImage from '@/assets/icons/logo-jd.svg';
import snImage from '@/assets/icons/logo-sn.svg';
import qqImage from '@/assets/images/qq.png';
import qywechat from '@/assets/images/qywechat.png';
import wechat from '@/assets/images/wechat.png';
import tbImage from '@/assets/icons/logo-taobao.svg';
import dyImage from '@/assets/icons/logo-douyin.svg';
import vipImage from '@/assets/icons/logo-wph.svg';
import mtImage from '@/assets/icons/logo-mt.svg';
import pddImage from '@/assets/icons/logo-pdd.svg';
import ksImage from '@/assets/icons/logo-ks.svg';
// import DkImage from '@/assets/images/dk.png';
import DkImage from '@/assets/icons/logo-douyin.svg';
import EleImage from '@/assets/icons/logo-elm.svg';
import CSJImage from '@/assets/images/csj.png';
import hdkdylogoImage from '@/assets/icons/hdkdylogo.svg';
import zygongxianglianm from '@/assets/icons/logo-zygongxianglianm.svg';
//联盟类型
const lms = [
    {
        name: '淘宝',
        type: 1,
    },
    {
        name: '京东',
        type: 2,
    },
    {
        name: '拼多多',
        type: 3,
    },
    {
        name: '唯品会',
        type: 4,
    },
    {
        name: '苏宁',
        type: 5,
    },
    {
        name: '快手',
        type: 8,
    },
    {
        name: '饿了么',
        type: 9,
    },
    {
        name: '美团美天赚',
        type: 12,
    },
    {
        name: '抖音达人',
        type: 13,
    },
    {
        name: '好单库抖音',
        type: 14,
    },
    {
        name: '知易联盟',
        type: 15,
    },
    {
        name: '抖音团购',
        type: 16,
    },
    {
        name: '穿山甲抖音（已暂停）',
        type: 11,
    },
    {
        name: '抖音抖客（已下线）',
        type: 10,
    },
    {
        name: '美团分销（已下线）',
        type: 7,
    },
];
//获取全部联盟信息
export const getLianMengType = () => {
    return lms;
};

/**
 * 根据联盟类型获取对应的Logo
 * @param type 联盟类型
 * @returns
 */
export const getlianMengTypeLogo = (type?: number) => {
    switch (type) {
        case 1:
            return tbImage;
        case 2:
            return jdImage;
        case 3:
            return pddImage;
        case 4:
            return vipImage;
        case 5:
            return snImage;
        case 6:
            return dyImage;
        case 10:
            return DkImage;
        case 7:
            return mtImage;
        case 8:
            return ksImage;
        case 9:
            return EleImage;
        case 11:
            return CSJImage;
        case 12:
            return mtImage;
        case 14:
            return hdkdylogoImage;
        case 13:
            return DkImage;
        case 15:
            return zygongxianglianm;
        case 16:
            return dyImage;
    }
    return '';
};

/**
 * 根据联盟类型获取对应的Logo
 * @param type 联盟类型
 * @param _flag
 * @returns
 */
export const getlianMengName = (type?: number, _flag?: boolean) => {
    let data = getLianMengType().find((w) => w.type == type);
    // if (flag && type === 7) {
    //     return '外卖';
    // }
    if (data) {
        return data.name;
    }
    return '';
};

/**
 * 根据联盟名称获取图标
 * @param name 联盟名称
 */
export const getlianMengTypeLogoByName = (name: string) => {
    name = name.replace('联盟', '');
    name = name.replace('分销', '');
    return getlianMengTypeLogo(lms.find((w) => w.name == name)?.type);
};
/**
 * 格式化联盟名称
 * @param name 名称
 * @returns
 */
export const formatlianMengName = (name: string) => {
    name = name.replace('联盟', '');
    name = name.replace('分销', '');
    return name;
};

/**
 * 根据联盟类型获取对应的网站地址
 * @param type 联盟类型
 * @returns
 */
export const getlianMengSite = (type: number) => {
    switch (type) {
        case 1:
            return 'https://pub.alimama.com';
        case 2:
            return 'https://union.jd.com/index';
        case 3:
            return 'https://jinbao.pinduoduo.com/';
        case 4:
            return 'https://union.vip.com/index#/';
        case 5:
            return 'https://sums.suning.com';
        case 6:
            return 'https://buyin.jinritemai.com/';
        case 7:
            return 'https://pub.meituan.com/';
        case 8:
            return 'https://cps.kwaixiaodian.com';
        case 10:
            return 'https://buyin.jinritemai.com/mpa/account/douke-login?log_out=1';
        case 9:
            return 'https://union.ele.me/';
        case 11:
            return 'https://www.csjplatform.com/';
        case 12:
            return 'https://media.meituan.com/pc/index.html#/';
        case 13:
            return 'https://buyin.jinritemai.com/mpa/account/login?log_out=1&type=24';
        case 14:
            return 'https://www.haodanku.com/';
        case 15:
            return 'https://pub.zycloud.net.cn';
    }
    return '';
};
/**
 * 根据联盟类型获取对应的网站地址
 * @param type 联盟类型
 * @returns
 */
export const getlianMengRoot = (type: number) => {
    switch (type) {
        case 1:
            return 'orders-tb';
        case 2:
            return 'orders-jd';
        case 3:
            return 'orders-pdd';
        case 4:
            return 'orders-vip';
        case 5:
            return 'orders-sn';
        case 6:
            return 'orders-dy';
        case 7:
            return 'orders-mt';
        case 8:
            return 'orders-ks';
        case 10:
            return 'orders-dk';
        case 11:
            return 'orders-csj';
        case 12:
            return 'orders-mtz';
        case 13:
            return 'orders-dy';
        case 14:
            return 'orders-hdkdylogo';
        case 15:
            return 'orders-share-lm';
    }
    return '';
};
/**
 * 获取机器人类型的Iocn
 * @param type 机器人类型
 * @returns
 */
export const getRobotTypeLogo = (type: number) => {
    switch (type) {
        case 0:
            return wechat; //个人微信
        case 1:
            return qywechat; //企业微信
        case 2:
            return qqImage; //QQ
    }
    return '';
};

// 获取商品类型名称
export const getProductTypeName = (type: number) => {
    /**
     *  无 = 0,
    淘宝 = 1,
    京东 = 2,
    拼多多 = 3,
    唯品会 = 4,
    苏宁 = 5,
    快手 = 8,
    饿了么本地生活 = 9,
    美团本地生活 = 12,
    抖音电商 = 10,
    抖音团购 = 16
     */

    switch (type) {
        case 1:
            return '淘宝';
        case 2:
            return '京东';
        case 3:
            return '拼多多';
        case 4:
            return '唯品会';
        case 5:
            return '苏宁';
        case 8:
            return '快手';
        case 9:
            return '饿了么';
        case 12:
            return '美团';
        case 10:
            return '抖音电商';
        case 16:
            return '抖音团购';
    }
    return '';
};
